from django.db import models

# Create your models here.

class Publisher(models.Model):
	name=models.CharField(max_length=30)
	city=models.CharField(max_length=50)
	address=models.CharField(max_length=50)
	website=models.URLField()

	class Meta:
		permissions=(
				('view_publisher','can view publisher'),
				)


	def __unicode__(self):
		return self.name

class Author(models.Model):
	first_name=models.CharField(max_length=30)
	last_name=models.CharField(max_length=30)
	email=models.EmailField()
	def __unicode__(self):
		return u'%s %s '%(self.first_name,self.last_name)

class Book(models.Model):
	title=models.CharField(max_length=50)
	authors=models.ManyToManyField(Author)
	publisher=models.ForeignKey(Publisher)
	publication_date=models.DateField()

	
